local skel = fk.CreateSkill{
  name = "#sj_zhoushuhuizhan__shihua_choose",
}

Fk:loadTranslationTable{
  ["#sj_zhoushuhuizhan__shihua_choose"] = "十划",
}

skel:addEffect("active", {
  prompt = function (self, player, selected_cards, selected_targets)
    local id, min, max = self.extra_data.id, self.extra_data.min, self.extra_data.max
    if #self.extra_data.list == 1 then
      return "#sj_zhoushuhuizhan__shihua_dis5::"..id..":"..min..":"..max
    end
    if self.interaction.data == "#sj_zhoushuhuizhan__shihua_2::"..id..":"..min..":"..max then
      return "#sj_zhoushuhuizhan__shihua_dis2::"..id..":"..min..":"..max
    end
    if self.interaction.data == "#sj_zhoushuhuizhan__shihua_3::"..id..":"..min..":"..max then
      return "#sj_zhoushuhuizhan__shihua_dis3::"..id..":"..min..":"..max
    end
    return "#sj_zhoushuhuizhan__shihua_dis4::"..id..":"..min..":"..max
  end,
  interaction = function (self, player)
    local id, min, max = self.extra_data.id, self.extra_data.min, self.extra_data.max
    local list = {
      "#sj_zhoushuhuizhan__shihua_2::"..id..":"..min..":"..max,
      "#sj_zhoushuhuizhan__shihua_3::"..id..":"..min..":"..max,
      "#sj_zhoushuhuizhan__shihua_4",
      "#sj_zhoushuhuizhan__shihua_5",
    }
    return UI.ComboBox{
      choices = self.extra_data.list,
      all_choices = list,
    }
  end,
  target_filter = Util.FalseFunc,
  card_filter = function (self, player, to_select, selected, selected_targets)
    if #selected == 2 or player:prohibitDiscard(to_select) then return false end
    local id, min, max = self.extra_data.id, self.extra_data.min, self.extra_data.max
    local card = Fk:getCardById(to_select)
    if self.interaction.data == "#sj_zhoushuhuizhan__shihua_3::"..id..":"..min..":"..max then
      return card.number > min and card.number < max and #selected < 1
    else
      return (card.number < min or card.number > max) and #selected < 2
    end
  end,
  feasible = function (self, player, selected, selected_cards, card)
    local id, min, max = self.extra_data.id, self.extra_data.min, self.extra_data.max
    local n = 2
    if self.interaction.data == "#sj_zhoushuhuizhan__shihua_3::"..id..":"..min..":"..max then
      n = 1
    end
    return #selected_cards == n
  end,
})

return skel